Ensure use of QMessageBox-using QMessageBox::critical
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 28 Nov 2024 09:04:50 +0000 (17:04 +0800)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Fri, 20 Dec 2024 15:26:57 +0000 (16:26 +0100)
Fixes deprecation warnings

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
f ensure qmessagebox

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
f2 ensure qm

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
f3

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
f4

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/application.cpp
src/gui/editlocallymanager.cpp
src/gui/foldercreationdialog.cpp
src/gui/generalsettings.cpp
src/gui/main.cpp
src/gui/socketapi/socketapi.cpp

index dcac6ad3234fc4a6857f7198ca9fe96a257f7372..0aaeffd79eae6bdaafd56c77ba356f367e781ec7 100644 (file)
@@ -588,7 +588,8 @@ AccountManager::AccountsRestoreResult Application::restoreLegacyAccount()
                 tr("There was an error while accessing the configuration "
                    "file at %1. Please make sure the file can be accessed by your system account.")
                     .arg(ConfigFile().configFile()),
-                tr("Quit %1").arg(Theme::instance()->appNameGUI()));
+                QMessageBox::Ok
+            );
             QTimer::singleShot(0, qApp, &QCoreApplication::quit);
         }
     }
index 59c25e830b03b235700ce59d7146583bf656b797..e2c3d3c7ecf5ff05d0065a9d4f2c13396a87d174 100644 (file)
@@ -52,7 +52,7 @@ void EditLocallyManager::showError(const QString &message, const QString &inform
 void EditLocallyManager::showErrorNotification(const QString &message, 
                                                const QString &informativeText)
 {
-    Systray::instance()->showMessage(message, informativeText, Systray::MessageIcon::Critical); 
+    Systray::instance()->showMessage(message, informativeText, Systray::MessageIcon::Critical);
 }
 
 void EditLocallyManager::showErrorMessageBox(const QString &message, 
index a245c9f4dc461a4b1da97e5df297f6f215d25edd..302bc041282bc0d41234817b3efda87504c836ed 100644 (file)
@@ -77,7 +77,7 @@ void FolderCreationDialog::accept()
     if (QDir(_destination).mkdir(ui->newFolderNameEdit->text())) {
         Q_EMIT folderCreated(fullPath);
     } else {
-        QMessageBox::critical(this, tr("Error"), tr("Could not create a folder! Check your write permissions."));
+        QMessageBox::critical(this, tr("Error"), tr("Could not create a folder! Check your write permissions."), QMessageBox::Ok);
     }
 
     QDialog::accept();
index 562e41642ccfe3cbb372261e3f94cbbdc3b67bb7..843be0dd568b65dd9794f5d4ec7b5eee588f1ccc 100644 (file)
@@ -129,7 +129,8 @@ bool createDebugArchive(const QString &filename)
         QMessageBox::critical(
             nullptr,
             QObject::tr("Failed to create debug archive"),
-            QObject::tr("Could not create debug archive in selected location!")
+            QObject::tr("Could not create debug archive in selected location!"),
+            QMessageBox::Ok
         );
         return false;
     }
index da946bc3b32c01abd28f1a7b5e09456c7e0faa71..b603a8a7c0b1422f8cd3929e266a8bf37a145360 100644 (file)
@@ -45,12 +45,16 @@ using namespace OCC;
 
 void warnSystray()
 {
-    QMessageBox::critical(nullptr, qApp->translate("main.cpp", "System Tray not available"),
+    QMessageBox::critical(
+        nullptr,
+        qApp->translate("main.cpp", "System Tray not available"),
         qApp->translate("main.cpp", "%1 requires on a working system tray. "
                                     "If you are running XFCE, please follow "
                                     "<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. "
                                     "Otherwise, please install a system tray application such as \"trayer\" and try again.")
-            .arg(Theme::instance()->appNameGUI()));
+            .arg(Theme::instance()->appNameGUI()),
+        QMessageBox::Ok
+    );
 }
 
 int main(int argc, char **argv)
index cf47d3f5bcd5ececef611e72c8d3655ffdb66f56..a3df567ee1fe55ebde66c985ceec0fb50a4a8029 100644 (file)
@@ -546,10 +546,13 @@ void SocketApi::processEncryptRequest(const QString &localFile)
     Q_ASSERT(rec.isValid());
 
     if (!account->e2e() || account->e2e()->_mnemonic.isEmpty()) {
-        const int ret = QMessageBox::critical(nullptr,
-                                              tr("Failed to encrypt folder at \"%1\"").arg(fileData.folderRelativePath),
-                                              tr("The account %1 does not have end-to-end encryption configured. "
-                                                 "Please configure this in your account settings to enable folder encryption.").arg(account->prettyName()));
+        const int ret = QMessageBox::critical(
+            nullptr,
+            tr("Failed to encrypt folder at \"%1\"").arg(fileData.folderRelativePath),
+            tr("The account %1 does not have end-to-end encryption configured. "
+               "Please configure this in your account settings to enable folder encryption.").arg(account->prettyName()),
+            QMessageBox::Ok
+        );
         Q_UNUSED(ret)
         return;
     }
@@ -563,10 +566,13 @@ void SocketApi::processEncryptRequest(const QString &localFile)
     job->setParent(this);
     connect(job, &OCC::EncryptFolderJob::finished, this, [fileData, job](const int status) {
         if (status == OCC::EncryptFolderJob::Error) {
-            const int ret = QMessageBox::critical(nullptr,
-                                                  tr("Failed to encrypt folder"),
-                                                  tr("Could not encrypt the following folder: \"%1\".\n\n"
-                                                     "Server replied with error: %2").arg(fileData.folderRelativePath, job->errorString()));
+            const int ret = QMessageBox::critical(
+                nullptr,
+                tr("Failed to encrypt folder"),
+                tr("Could not encrypt the following folder: \"%1\".\n\n"
+                   "Server replied with error: %2").arg(fileData.folderRelativePath, job->errorString()),
+                QMessageBox::Ok
+            );
             Q_UNUSED(ret)
         } else {
             const int ret = QMessageBox::information(nullptr,